#ifndef LOCK_EX_MALWARE_TEAM_H_
#define LOCK_EX_MALWARE_TEAM_H_

class CLock
{
public:
	CLock()
	{
		::InitializeCriticalSection( &cs );
	}
	~CLock()
	{
		::DeleteCriticalSection( &cs );
	}

#if(_WIN32_WINNT >= 0x0500)
	BOOL TryLock()
	{
		return ::TryEnterCriticalSection( &cs );
	}
#endif

	void Lock()
	{
		::EnterCriticalSection(&cs);
	}
	void Release()
	{
		::LeaveCriticalSection(&cs);
	}

	CRITICAL_SECTION &	GetCS()
	{
		return cs;
	}

	operator CRITICAL_SECTION& ()
	{
		return cs;
	}

private:
	CRITICAL_SECTION	cs;
};

#endif // LOCK_EX_MALWARE_TEAM_H_